# -*- coding: utf-8 -*-
from Page.inqueryPage import inqueryPage
from selenium.webdriver.support.ui import Select
import time
import xlrd
class inquery():
    def __init__(self,driver):
        self.driver=driver
        self.inqueryPage=inqueryPage(self.driver)
    def Assign_To(self,PolicyNo):
        self.inqueryPage.btnIntegratedquery().click()
        time.sleep(1)
        self.inqueryPage.inpPolicyNo().send_keys(PolicyNo)
        time.sleep(1)
        self.inqueryPage.btnQuery().click()
        time.sleep(1)
        self.inqueryPage.btnAssign().click()
        time.sleep(1)
        window1 = self.driver.window_handles
        self.driver.switch_to.window(window1[-1])
        time.sleep(1)
        PrePoicyMan=self.inqueryPage.inpPolicyMan().get_attribute('value')
        if PrePoicyMan!='Crystal':
            print("当前处理人！=指派人员")
            self.inqueryPage.inpAssignTo().click()
            time.sleep(1)
            self.driver.find_element_by_xpath("//span[text()='Crystal']").click()
            time.sleep(1)
            self.inqueryPage.btnComfire().click()
            time.sleep(1)
            self.inqueryPage.btnSumbit().click()
            time.sleep(1)
        else:
            print('当前处理人=指派人员')
            self.inqueryPage.btnCancel().click()
            time.sleep(1)
    def UWdecision(self,PolicyNo):
        self.inqueryPage.btnIntegratedquery().click()
        time.sleep(1)
        self.inqueryPage.inpPolicyNo().send_keys(PolicyNo)
        time.sleep(1)
        self.inqueryPage.btnQuery().click()
        time.sleep(1)
        self.inqueryPage.inpUWdecision().text
        time.sleep(1)
        print(self.inqueryPage.inpUWdecision().text)


        # Select(self.inqueryPage.secAssignTo()).select_by_visible_text(PolicyMan)
        # time.sleep(1)






